package com.nbrc.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * RolePriv entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "role_priv", catalog = "nbrcactiviti")
public class RolePriv implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 172094012594797525L;
	private String id;
	private String ioc;
	private String title;
	private String urls;
	private Set<Menu> menus = new HashSet<Menu>(0);

	// Constructors

	/** default constructor */
	public RolePriv() {
	}

	/** minimal constructor */
	public RolePriv(String id) {
		this.id = id;
	}

	/** full constructor */
	public RolePriv(String id, String ioc, String title, String urls,
			Set<Menu> menus) {
		this.id = id;
		this.ioc = ioc;
		this.title = title;
		this.urls = urls;
		this.menus = menus;
	}

	// Property accessors
	@Id
	@Column(name="id",nullable = false,length=40)
	@GeneratedValue(generator="system-uuid")
	@GenericGenerator(name="system-uuid",strategy="org.hibernate.id.UUIDGenerator")
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "ioc")
	public String getIoc() {
		return this.ioc;
	}

	public void setIoc(String ioc) {
		this.ioc = ioc;
	}

	@Column(name = "title")
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "urls")
	public String getUrls() {
		return this.urls;
	}

	public void setUrls(String urls) {
		this.urls = urls;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "rolepriv_has_menu", catalog = "nbrcactiviti", joinColumns = { @JoinColumn(name = "rolepriv_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "menu_id", nullable = false, updatable = false) })
	public Set<Menu> getMenus() {
		return this.menus;
	}

	public void setMenus(Set<Menu> menus) {
		this.menus = menus;
	}

}